//
//  HHBezierData.m
//  BezierDemo
//
//  Created by eric on 14-5-7.
//  Copyright (c) 2014年 eric. All rights reserved.
//

#import "HHBezierData.h"
#import <QuartzCore/QuartzCore.h>
@implementation HHBezierData
@synthesize interpolantPointsX;
@synthesize interpolantPointsY;
- (id)init
{
    if (self = [super init])
    {
        interpolantPointsX = BZCreateMatrix(3,1);
        interpolantPointsY = BZCreateMatrix(3,1);
        
        controlNumber = 3;
        [self resetControlPoint];
        
    }
    return self;
}
- (void)resetControlPoint
{
    for (int i = 0; i < interpolantPointsX.rowCount; i++)
    {
        interpolantPointsX.data[i][0]=0.3f*(i+1);
        interpolantPointsY.data[i][0]= 0.0;
    }
}

- (void)addControlPoint
{
    controlNumber++;
    interpolantPointsX = BZCreateMatrix(controlNumber,1);
    interpolantPointsY = BZCreateMatrix(controlNumber,1);
    [self resetControlPoint];
}

- (void)removeControlPoint
{
    if (controlNumber < 3)
    {
        return;
    }
    controlNumber--;
    interpolantPointsX = BZCreateMatrix(controlNumber,1);
    interpolantPointsY = BZCreateMatrix(controlNumber,1);
    [self resetControlPoint];
}

@end
